package models

import (
	"time"
	"gorm.io/gorm"
)

// Wallet 钱包模型
type Wallet struct {
	ID        uint      `json:"id" gorm:"primaryKey"`
	Name      string    `json:"name" gorm:"uniqueIndex;not null"`
	Address   string    `json:"address" gorm:"uniqueIndex;not null"`
	PublicKey string    `json:"public_key" gorm:"not null"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
	DeletedAt gorm.DeletedAt `json:"-" gorm:"index"`
}

// TableName 指定表名
func (Wallet) TableName() string {
	return "wallets"
}

// WalletBalance 钱包余额
type WalletBalance struct {
	Address string `json:"address"`
	Balance string `json:"balance"`
}

// CreateWalletRequest 创建钱包请求
type CreateWalletRequest struct {
	Name string `json:"name" binding:"required,min=1,max=50"`
}

// UpdateWalletRequest 更新钱包请求
type UpdateWalletRequest struct {
	Name string `json:"name" binding:"required,min=1,max=50"`
}

// WalletResponse 钱包响应
type WalletResponse struct {
	ID        uint   `json:"id"`
	Name      string `json:"name"`
	Address   string `json:"address"`
	Balance   string `json:"balance"`
	CreatedAt string `json:"created_at"`
}
